package com.ruoyi.second.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.second.mapper.SecondHandhouseMapper;
import com.ruoyi.second.domain.SecondHandhouse;
import com.ruoyi.second.service.ISecondHandhouseService;

/**
 * 二手房源Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-12
 */
@Service
public class SecondHandhouseServiceImpl implements ISecondHandhouseService 
{
    @Autowired
    private SecondHandhouseMapper secondHandhouseMapper;

    /**
     * 查询二手房源
     * 
     * @param id 二手房源主键
     * @return 二手房源
     */
    @Override
    public SecondHandhouse selectSecondHandhouseById(Long id)
    {
        return secondHandhouseMapper.selectSecondHandhouseById(id);
    }

    /**
     * 查询二手房源列表
     * 
     * @param secondHandhouse 二手房源
     * @return 二手房源
     */
    @Override
    public List<SecondHandhouse> selectSecondHandhouseList(SecondHandhouse secondHandhouse)
    {
        return secondHandhouseMapper.selectSecondHandhouseList(secondHandhouse);
    }

    /**
     * 新增二手房源
     * 
     * @param secondHandhouse 二手房源
     * @return 结果
     */
    @Override
    public int insertSecondHandhouse(SecondHandhouse secondHandhouse)
    {
        secondHandhouse.setCreateTime(DateUtils.getNowDate());
        return secondHandhouseMapper.insertSecondHandhouse(secondHandhouse);
    }

    /**
     * 修改二手房源
     * 
     * @param secondHandhouse 二手房源
     * @return 结果
     */
    @Override
    public int updateSecondHandhouse(SecondHandhouse secondHandhouse)
    {
        secondHandhouse.setUpdateTime(DateUtils.getNowDate());
        return secondHandhouseMapper.updateSecondHandhouse(secondHandhouse);
    }

    /**
     * 批量删除二手房源
     * 
     * @param ids 需要删除的二手房源主键
     * @return 结果
     */
    @Override
    public int deleteSecondHandhouseByIds(Long[] ids)
    {
        return secondHandhouseMapper.deleteSecondHandhouseByIds(ids);
    }

    /**
     * 删除二手房源信息
     * 
     * @param id 二手房源主键
     * @return 结果
     */
    @Override
    public int deleteSecondHandhouseById(Long id)
    {
        return secondHandhouseMapper.deleteSecondHandhouseById(id);
    }
}
